import hec.heclib.dss.HecDss
from hec.script import *
from hec.heclib.dss import *
from hec.heclib.util import *
from hec.io import *
from hec.script import *
from hec.hecmath import *
from java import *
import Tools

#inFile = 

inFile = HecDss.open("dss/OriginalSV.dss", "01OCT1986 0000, 01OCT1987 0000")
outFile = HecDss.open("dss/ShiftedSV.dss")

pathList = inFile.getPathnameList()
pathList = Tools.getUniquePath(pathList)

path_condensed = inFile.getCondensedCatalog()

for c in path_condensed[0:1]:
    print "condensed: " + str(c)
    path_test = DSSPathname(str(c))
    print "condensed bpart: " + path_test.bPart()

for a in pathList[0:1]:
    print "normal: "+ str(a)

 
#dssFile = DSS.open("C:/pattemp/sample.dss", "10MAR2006 2400, 09APR2006 2400")
outflow = inFile.read(a)
outflow = inFile.read("/CALSIM/DEMAND_D3/DEMAND//1MON/ORIGINAL/")
newOutflow = outflow.add(10.)
shiftedData = outflow.shiftInTime("1Y")
path = DSSPathname(newOutflow.getPath())
path2  = DSSPathname(shiftedData.getPath())
fPart = path.fPart() + " + what HecMath"
fPart2 = path2.fPart() + " shifted"
path.setFPart(fPart)
path2.setFPart(fPart2)
newOutflow.setPathname(path.getPathname())
shiftedData.setPathname(path2.getPathname())
outFile.write( shiftedData)


